atc-installer: configure validation webhook timeout#211
atc-installer: configure validation webhook timeout#211alam-cloud wants to merge 3 commits intoyokecd:mainfrom
Conversation
Add support for configuring validation webhook timeout when installing the ATC. - Add ValidationWebhookTimeout field to installer Config - Pass timeout as VALIDATION_WEBHOOK_TIMEOUT environment variable - Load timeout from env var in ATC config - Apply timeout to all validation webhooks (default: 10s) Fixes yokecd#129
|
Key changes:
The timeout is optional - if not specified, it defaults to 10 seconds (Kubernetes default). Let me know if you'd like any changes! 👍 |
cmd/atc-installer/installer/run.go
Outdated
| DockerConfigSecretName string `json:"dockerConfigSecretName,omitzero" Description:"name of dockerconfig secret to allow atc to pull images from private registries"` | ||
| LogFormat string `json:"logFormat,omitzero" Enum:"json,text"` | ||
| Verbose bool `json:"verbose,omitzero" Description:"verbose logging"` | ||
| ValidationWebhookTimeout *int32 `json:"validationWebhookTimeout,omitzero" Description:"timeout in seconds for validation webhooks (default: 10)"` |
There was a problem hiding this comment.
I think a pointer is not necessary in this case. If the value is 0 or less than 0 we can ignore the field.
cmd/atc-installer/installer/run.go
Outdated
| if cfg.ValidationWebhookTimeout != nil { | ||
| env = append(env, corev1.EnvVar{ | ||
| Name: "VALIDATION_WEBHOOK_TIMEOUT", | ||
| Value: strconv.FormatInt(int64(*cfg.ValidationWebhookTimeout), 10), |
There was a problem hiding this comment.
if we use an int which is completely reasonable as the installer does not need to be optimized (its run once or once in a while) we could use the strconv.Itoa and avoid the type casts and dereferencing.
cmd/atc/config.go
Outdated
| } | ||
|
|
||
| cfg.Service.CABundle = cfg.TLS.CA.Data | ||
| cfg.Service.ValidationWebhookTimeout = cfg.ValidationWebhookTimeout |
There was a problem hiding this comment.
I dont' think we need to put the timeout on the service structure. That is intended to define the k8s service that backs the atc and its tls requirements.
cmd/atc/resources.go
Outdated
| } | ||
|
|
||
| // Get timeout value, defaulting to 10 seconds if not configured | ||
| timeoutSeconds := cmp.Or(cfg.ValidationWebhookTimeout, ptr.To[int32](10)) |
There was a problem hiding this comment.
It might be a good idea to have different timeout values? Instead of one global flag for all webhooks have three different ones?
davidmdm
left a comment
There was a problem hiding this comment.
Awesome start! Love to see it!
…viceDef - Change ValidationWebhookTimeout from *int32 to int32 in installer Config - Use strconv.Itoa instead of pointer dereferencing - Remove ValidationWebhookTimeout from ServiceDef (it's for k8s service definition) - Pass timeout as separate parameter to GetReconciler - Add timeout field to atc struct instead Addresses review comments from @davidmdm
- Replace single ValidationWebhookTimeout with three separate fields: - AirwayValidationWebhookTimeout (default: 10s) for airway instances - ResourceValidationWebhookTimeout (default: 5s) for event dispatching - ExternalResourceValidationWebhookTimeout (default: 30s) for external resources - Update installer Config and ATC Config to support separate timeouts - Apply appropriate timeout to each webhook type based on its purpose - Update GetReconciler to use AirwayValidationWebhookTimeout for per-Airway webhooks
Add support for configuring validation webhook timeout when installing the ATC.
Fixes #129